package net.hn.hnms.biz.safety.monitor.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import net.hn.hnms.biz.api.safety.monitor.model.ChartVo;
import net.hn.hnms.biz.safety.monitor.domain.AqjkNowSensorMonitorEntity;
import net.hn.hnms.biz.safety.monitor.service.DustService;
import net.hn.hnms.sys.common.core.domain.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 智呈物联 pan'sx
 * 2022/10/10 10:27
 * 1.0 version
 */
@RestController
@RequestMapping("riskMonitor/dust")
@Api(value = "粉尘监控控制器", tags = {"粉尘监控"})
@RequiredArgsConstructor
//@Deprecated //粉尘查询的dust模块了
public class DustController {
    private final DustService dustService;

    @GetMapping("monitorNow")
    @ApiOperation("数据查询-实时数据")
    public R<List<AqjkNowSensorMonitorEntity>> monitor(@RequestParam(value = "pointCode", required = false, defaultValue = "粉尘") String sensorTypeName) {
        return R.ok(dustService.monitor(sensorTypeName));
    }


    @GetMapping("alarmTrend")
    @ApiOperation("报警趋势")
    public R<ChartVo> alarmTrend(@ApiParam("周或月") @RequestParam(defaultValue = "周") String type) {
        return R.ok(dustService.alarmTrend(type));
    }

    @GetMapping("concentrationTrend")
    @ApiOperation("粉尘趋势")
    public R<ChartVo> monitorTrend(@ApiParam("天或周") @RequestParam(defaultValue = "天") String type,
                                   @ApiParam(value = "测点编码", required = true) String pointCode) {
        return R.ok(dustService.monitorTrend(type, pointCode));
    }
}
